import request from '@/untils/request'


//客户查询
export const selectSale = (customerId,customerName,PageNum,PageSize) => {
    return request({
        url: '/xscustomert/getlist',
        method: 'get',
        params:{
            customerId,
            customerName,
            PageNum,
            PageSize
        }
    })
}


//客户添加
export const addCustomer = (xScustomer) => {
    // console.log(xScustomer)
    return request({
        url: '/xscustomert/add',
        method: 'post',
        data:xScustomer,
    })
}


//客户修改
export const updateCustomer = (xScustomer) => {
    return request({
        url: '/xscustomert/update',
        method:'put',
        data:xScustomer
    })
}

//客户删除
export const deleteCustomer = (customerId) => {
    return request({
        url: '/xscustomert/delete',
        method: 'delete',
        params:{
            customerId
        }

    })
}

// 查看订单
export const selectOrder = (cuid,id,maTid,PageNum,PageSize)=>{
        return request({
            //http://localhost:8888/xsorder/getList
            url: '/xsorder/getList',
            method: 'GET',
            params:{
                cuid,
                id,
                maTid,
                PageNum,
                PageSize
            }

        })
    }


//    添加订单
export const addOrder = (xsOrder) => {
    // console.log(xsOrder)
    return request({
        url: '/xsorder/add',
        method: 'post',
        data:xsOrder,
    })
}

//  根据id查询订单,并且把此订单中商品的库存，存到商品库里
export const selectOrderById = (xsOrder) => {
    return request({
        url: '/xsorder/getById',
        method: 'post',
        data:xsOrder,
    })
}

// 修改订单
export const updateOrder = (xsOrder) => {
    return request({
        url: '/xsorder/update',
        method: 'post',
        data:xsOrder,
    })
}

//审批订单
export const approvalOrder = (id,approvalStatus,comment) => {
    // console.log(id,approvalStatus,comment)
    return request({
        url: '/xsorder/updateStatus',
        method: 'post',
        params:{
            id,
            approvalStatus,
            comment
        }
    })
}

//    订单的发货收款
export const updateOrderStatus = (xsOrder) => {
    // console.log(xsOrder)
    return request({
        url: '/xsorder/updateShipmentStatus',
        method: 'post',
        data:xsOrder,
    })
}


//删除订单
export const deleteOrder = (id) => {
    // console.log(id)
    return request({
        url: '/xsorder/delete',
        method: 'delete',
        params:{
            id
        }

    })
}



